package com.xianyun.smartpicturebackend.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.xianyun.smartpicturebackend.model.dto.user.UserQueryRequest;
import com.xianyun.smartpicturebackend.model.dto.user.UserRegisterRequest;
import com.xianyun.smartpicturebackend.model.entity.User;
import com.baomidou.mybatisplus.extension.service.IService;
import com.xianyun.smartpicturebackend.model.vo.UserLoginVO;
import com.xianyun.smartpicturebackend.model.vo.UserVO;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
* @author jxm12
* @description 针对表【user(用户)】的数据库操作Service
* @createDate 2025-02-12 22:15:24
*/
public interface UserService extends IService<User> {
    /**
     * 用户注册
     * @param userRegisterRequest
     * @return
     */
    long userRegister(UserRegisterRequest userRegisterRequest);

    /**
     * 用户登录
     * @param userAccount
     * @param userPassword
     * @param request
     * @return
     */
    UserLoginVO userLogin(String userAccount, String userPassword, HttpServletRequest request);

    User getLoginUser(HttpServletRequest request);

    /**
     * 注销用户登陆态
     * @param request
     * @return
     */
    boolean userLogout(HttpServletRequest request);

    /**
     * 加密用户密码
     * @param uerPassword
     * @return
     */
    String getEncryptPassword(String uerPassword);

    /**
     * 获取登录后，用户脱敏信息
     * @param user
     * @return
     */
    UserLoginVO getLoginUserVO(User user);

    /**
     * 给普通用户返回查询后的用户脱敏信息
     * @param user
     * @return
     */
    UserVO getUserVO(User user);

    /**
     * 返回脱敏后的用户列表
     * @param userList
     * @return
     */
    List<UserVO> getUserVOList(List<User> userList);

    /**
     * 获取查询条件
     * @param userQueryRequest
     * @return
     */
    QueryWrapper<User> getQueryWrapper(UserQueryRequest userQueryRequest);

    /**
     * 判断当前登录的用户是否为管理员
     * @param user
     * @return
     */
    boolean isAdmin(User user);


}

